<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/8/26 0026
 * Time: 19:06
 */
$game = new \main\game();
$链接_创建门派 = $game->create_url("cmd=npc&&nid={$arr_data->nid}&canshu=newclub","创建门派");
$player = $game->player_get_uinfo();

$gnhtml ="
=======门派创建=======<br/>
天地不仁&nbsp;&nbsp;修道即修盗<br/>
大道不止&nbsp;&nbsp;大盗路不止<br/>
想要盗出仙路&nbsp;&nbsp;一人..太难..<br/>
{$链接_创建门派}<br/>";
$clubplayer = $game->clubplayer_get_player();

if (isset($_POST['canshu'])){
    $arr_data->canshu = $_POST['canshu'];
}

if (isset($arr_data->canshu)){
    switch ($arr_data->canshu){
        case "newclub":
            if ($clubplayer){
                $gnhtml= "<br/>你已经有门派了<br/>";
                break;
            }

            $gnhtml="
            <form method='post'>
            <input type='hidden' name='canshu' value='club_create'>
            门派大名:<input name='clubname'><br/>
            门派说明:<textarea name='clubinfo' style='height: 80px'></textarea>
            <br/>
            <input type='submit' value='创建'>
            </form>";

            break;
        case "club_create":
            if ($clubplayer){
                $gnhtml= "<br/>你已经有门派了<br/>";
                break;
            }

            $clubname = htmlspecialchars($_POST['clubname']);
            $clubinfo = htmlspecialchars($_POST['clubinfo']);

            if (strlen($clubname)<6 || strlen($clubname)>12){
                $gnhtml = "<br/>名称过长或过短<br/>";
                break;
            }

            $clubid = $game->club_creater($clubname,$clubinfo,1,0,$player->uid);
            $game->clubplayer_join($clubid);
            $game->clubplayer_set_uclv($clubid , $player->uid , 1);
            $点击进入 = $game->create_url("cmd=club&canshu=into_club","点击进入");
            $gnhtml.= "<br/>门派创建成功<br/>{$点击进入}";
            break;
    }
}

?>

